package com.mouse.util;

import java.io.InputStream;
import java.util.Properties;

/**
 * @Auther: liu
 * @Date: 2024/5/2511:24
 */
public class PropertiesUtil {
    //单例模式
    private  static  PropertiesUtil propertiesUtil = null;

    //读取配置文件使用
    private Properties properties;
    private PropertiesUtil(){
        Properties  properties= new Properties();
        InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream("com/mouse/config.properties");

        //将配置文件加载到Properties里面
        try{
            properties.load(inputStream);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


        public static PropertiesUtil getPropertiesUtil(){
        if (propertiesUtil==null) {
            propertiesUtil = new PropertiesUtil();
        }
        return  propertiesUtil;
        }

        public  String getValue(String key){
        return properties.getProperty(key);
        }



}
